﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title - Leiktu þér á netinu</title>
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <link href='http://fonts.googleapis.com/css?family=Sancreek|Smythe|Nothing+You+Could+Do|Devonshire|Monsieur+La+Doulaise|Swanky+and+Moo+Moo|Yesteryear|Just+Me+Again+Down+Here' rel='stylesheet' type='text/css'>
    <meta name="viewport" content="width=device-width" />
    @Styles.Render("~/Content/themes/base/jquery-ui.css")
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @RenderSection("styles", required: false)
</head>
<body>
    <header>
        <div class="content-wrapper">
            <div class="float-left">
                <p class="site-title">@Html.ActionLink("Borðspil.is - G28", "Index", "Home")</p>
            </div>
            <div class="float-right">
                <nav>
                    <section id="topmenu">
                        <ul id="menu">
                            <li>@Html.ActionLink("Heim", "Index", "Home")</li>
                            <li>@Html.ActionLink("Um borðspil.is", "About", "Home")</li>
                            @if (Request.IsAuthenticated) 
                            {
                                if (Roles.IsUserInRole(User.Identity.Name, "Moderators") || Roles.IsUserInRole(User.Identity.Name, "Administrators"))
                                { 
                                    <li>@Html.ActionLink("Notendur", "ListUsers", "Account")</li>
                                }
                            }
                        </ul>
                    </section>
                </nav>
                <section id="login">
                    @Html.Partial("_LoginPartial")
                </section>
            </div>
        </div>
    </header>
    <div id="body">
        @RenderSection("featured", required: false)
        <section class="content-wrapper main-content clear-fix">
            @{
                // Check for message on session TempData and render it if needed.
                string message = TempData["message"] as string;
            }
            @if (message != null)
            {
                @:<div class="message @(TempData["messageType"])">@message</div>
                }
            @RenderBody()
        </section>

        <!-- Dialog for JqueryUI. For inviting user -->
        <div id="inviteUserDialog" title="Bjóða leikmanni" style="display: none;">
            <p>Skrifaðu nafn á leikmanni sem þú vilt bjóða:</p>
            <input type="text" name="user" id="user" maxlength="25" class="text ui-widget-content ui-corner-all" />
        </div>
        <!-- Dialog for JqueryUI. For inviting user by ID -->
        <div id="inviteUserIdDialog" title="Bjóða leikmanni(ID)" style="display: none;">
            <p>Skrifaðu ID á leikmanni sem þú vilt bjóða:</p>
            <input type="text" name="userId" id="userId" maxlength="15" class="text ui-widget-content ui-corner-all" />
        </div>
        <!-- Dialog for JqueryUI. For receiving invites from another user -->
        <div id="invitationRecieved" title="Þú hefur fengið boð!" style="display: none;">
            <p><span id="userInvited">Nafn hér</span> bauð þér til að spila með honum!</p>
            <p>Ýttu á "Taka þátt" ef þú vilt samþykkja boð hans og nýr gluggi mun opnast eða ýttu á "Cancel" ef þú vilt ekki samþykkja.</p>
        </div>

    </div>
    <footer>
        <div class="content-wrapper">
            <div class="float-left">
                <p>&copy; @DateTime.Now.Year - Borðspil.is  -  Group 28</p>
            </div>
        </div>
    </footer>

    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryui")
    @Scripts.Render("~/Scripts/knockout-2.1.0.js")
    <script src="~/Scripts/Underscore.min.js"></script>
    <!--Reference the SignalR library. -->
    <script src="~/Scripts/jquery.signalR-1.0.1.js"></script>
    <!--Reference the autogenerated SignalR hub script. -->
    <script src="~/signalr/hubs"></script>
    <script src="~/Javascripts/Invites.js"></script>
    <script>
        var myHub = $.connection.masterHub;
        var gameRoomInvite = 0;
        myHub.client.acceptInvite = function (roomID, playerName) {
            console.log("Invited");
            gameRoomInvite = roomID;
            $("#invitationRecieved p #userInvited").text(playerName);
            // Add the message to the page. 
            $("#invitationRecieved").dialog("open");
        };
    </script>
    @RenderSection("scripts", required: false)
    <script>
        //$.connection.hub.start({ waitForPageLoad: false });
        $(document).ready(function () {
            $.connection.hub.start({}, function () {
                // callback code
            });
        });
    </script>
</body>
</html>
